﻿using DesignPatterns.Factory.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DesignPatterns.Factory
{
    public class SimpleFactory
    {
        public static Fruit CreateFruit(string name)
        {
           var fruit = new Fruit("无",0,"无");
           switch (name)
            {
                case "apple":
                    fruit =  new Apple("苹果",10,"red");
                    break;
                case "orange":
                    fruit = new Orange("橘子",12,"red");
                    break;
                default: break;
            }

            return fruit;
        }
    }
}
